# makefile
# written by yaolunlun@sina.com
# version 1.0
# last update 09/13/2016

TOP_DIR		:= $(CURDIR)/../
include $(TOP_DIR)/Env.make

TARGET		:= opendev
SRCS		:= opendev.cpp shm_data.cpp
OBJS		:= $(SRCS:.cpp=.o)

CFLAGS		:= -g -Wall -Wl,-rpath=.  -D_LINUX -DDM3730 -O3 \
				-I./ \
				-I../include/ \
				-I../opendev_sdk/inc/ \
				-I../opendev_sdk/inc/osa/

LDFLAGS		:= -lrt -lpthread -lopendevsdk -L../opendev_sdk/lib \
				../opendev_sdk/lib/osa.a \
				../opendev_sdk/lib/libiconv.so.0 \
				../opendev_sdk/lib/libjsoncpp.a \
				../opendev_sdk/lib/libvznetdp.so


all: $(TARGET)

$(TARGET): $(OBJS)
	$(ECHO)echo LD $@
	$(ECHO)$(CPP) $(CFLAGS) -o $(TARGET) $(OBJS) $(LDFLAGS)

opendev-demo:
	$(MAKE) -C ../opendev_sdk/Demo

opendev-demo-clean:
	$(MAKE) clean -C ../opendev_sdk/Demo

%.o: %.cpp
	$(ECHO)echo CPP $@
	$(ECHO)$(CPP) $(CFLAGS) -c -o $@ $<

install:
	$(MKDIR) $(TOP_DIR)/bin/
	$(INSTALL) $(TARGET) $(TOP_DIR)/bin/

clean: opendev-demo-clean
	$(RM) *.o
	$(RM) $(TARGET)

	
.PHONY: all clean opendev-demo-clean opendev-demo

